import * as Apis from '../../apis/ReportApi';
import BaseFormStore from '../BaseFormStore';

class ReportTimeSectionFormStore extends BaseFormStore {
  getFormData(componentInitCallBack) {
    const type = 'reportTimeSectionForm';
    const routerParams = this.componentProps.params;
    Apis.getChanceReport(type, routerParams).then((data) => {
      componentInitCallBack(data);
    });
  }

  doSaveData(requestParams, doSaveCallBack) {
    const type = 'reportTimeSectionFormSave';
    const parentStore = this.componentProps.parentStore;
    Apis.getChanceReport(type, requestParams).then((data) => {
      doSaveCallBack(data);
      this.componentWillUnmount();
      parentStore.showCustomDialog(false);
      parentStore.doSearch();
    });
  }
}

export default ReportTimeSectionFormStore;
